import org.omg.CORBA.PUBLIC_MEMBER;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Microsoft
 * Date: 2022-11-26
 * Time: 16:55
 */

class Animal {
    public String name;
    public int age;

    public static void eat() {
        System.out.println(name + "正在吃饭");
    }
}

class Dog extends Animal {
    public void wangwang() {
        System.out.println(name + "正在汪汪叫");
    }
    //方法的重写
    @Override
    public void eat() {
        System.out.println(name + "正在吃狗粮");
    }
}

class Bird extends Animal {
    public String wing;  //翅膀

    //方法的重写
    @Override
    public void eat() {
        System.out.println(name + "正在吃鸟粮");
    }

    public void fly() {
        System.out.println(name + "正在飞");
    }
}
public class Test2 {
    public static void function(Animal animal) {
        animal.eat();
    }
    public static void main(String[] args) {
        Animal animal1 = new Dog();
        animal1.name = "十三月";
        function(animal1);

        Animal animal2 = new Bird();
        animal2.name = "小三";
        function(animal2);
    }
}








//    public static void func(Animal animal) {
//
//    }
//    public static void main(String[] args) {
//        Dog dog = new Dog();
//        func(dog);
//    }
//    public static Animal func1() {
//        return new Dog();
//    }



